/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.xmluimodel.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import uimigration.xmluimodel.Content;
import uimigration.xmluimodel.Object;
import uimigration.xmluimodel.Property;
import uimigration.xmluimodel.XmluimodelPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Object</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link uimigration.xmluimodel.impl.ObjectImpl#getChilds <em>Childs</em>}</li>
 *   <li>{@link uimigration.xmluimodel.impl.ObjectImpl#getName <em>Name</em>}</li>
 *   <li>{@link uimigration.xmluimodel.impl.ObjectImpl#getAttributs <em>Attributs</em>}</li>
 *   <li>{@link uimigration.xmluimodel.impl.ObjectImpl#getContent <em>Content</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ObjectImpl extends EObjectImpl implements
		uimigration.xmluimodel.Object {
	/**
	 * The cached value of the '{@link #getChilds() <em>Childs</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getChilds()
	 * @generated NOT
	 * @ordered
	 */
	protected EList<uimigration.xmluimodel.Object> childs;

	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The cached value of the '{@link #getAttributs() <em>Attributs</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAttributs()
	 * @generated NOT
	 * @ordered
	 */
	protected EList<Property> attributs;

	/**
	 * The cached value of the '{@link #getContent() <em>Content</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getContent()
	 * @generated NOT
	 * @ordered
	 */
	protected EList<Content> content;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ObjectImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return XmluimodelPackage.Literals.OBJECT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public EList<uimigration.xmluimodel.Object> getChilds() {
		if (childs == null) {
			childs = new EObjectContainmentEList<Object>(
					uimigration.xmluimodel.Object.class, this,
					XmluimodelPackage.OBJECT__CHILDS);
		}
		return childs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET,
					XmluimodelPackage.OBJECT__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public EList<Property> getAttributs() {
		if (attributs == null) {
			attributs = new EObjectContainmentEList<Property>(Property.class, this,
					XmluimodelPackage.OBJECT__ATTRIBUTS);
		}
		return attributs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public EList<Content> getContent() {
		if (content == null) {
			content = new EObjectContainmentEList<Content>(Content.class, this,
					XmluimodelPackage.OBJECT__CONTENT);
		}
		return content;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case XmluimodelPackage.OBJECT__CHILDS:
			return ((InternalEList<?>) getChilds()).basicRemove(otherEnd, msgs);
		case XmluimodelPackage.OBJECT__ATTRIBUTS:
			return ((InternalEList<?>) getAttributs()).basicRemove(otherEnd, msgs);
		case XmluimodelPackage.OBJECT__CONTENT:
			return ((InternalEList<?>) getContent()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public java.lang.Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case XmluimodelPackage.OBJECT__CHILDS:
			return  getChilds();
		case XmluimodelPackage.OBJECT__NAME:
			return getName();
		case XmluimodelPackage.OBJECT__ATTRIBUTS:
			return getAttributs();
		case XmluimodelPackage.OBJECT__CONTENT:
			return getContent();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	@SuppressWarnings("unchecked")
	public void eSet(int featureID, java.lang.Object newValue) {
		switch (featureID) {
		case XmluimodelPackage.OBJECT__CHILDS:
			getChilds().clear();
			getChilds().addAll((Collection<Object>) newValue);
			return;
		case XmluimodelPackage.OBJECT__NAME:
			setName((String) newValue);
			return;
		case XmluimodelPackage.OBJECT__ATTRIBUTS:
			getAttributs().clear();
			getAttributs().addAll((Collection<? extends Property>) newValue);
			return;
		case XmluimodelPackage.OBJECT__CONTENT:
			getContent().clear();
			getContent().addAll((Collection<? extends Content>) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
		case XmluimodelPackage.OBJECT__CHILDS:
			getChilds().clear();
			return;
		case XmluimodelPackage.OBJECT__NAME:
			setName(NAME_EDEFAULT);
			return;
		case XmluimodelPackage.OBJECT__ATTRIBUTS:
			getAttributs().clear();
			return;
		case XmluimodelPackage.OBJECT__CONTENT:
			getContent().clear();
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case XmluimodelPackage.OBJECT__CHILDS:
			return childs != null && !childs.isEmpty();
		case XmluimodelPackage.OBJECT__NAME:
			return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT
					.equals(name);
		case XmluimodelPackage.OBJECT__ATTRIBUTS:
			return attributs != null && !attributs.isEmpty();
		case XmluimodelPackage.OBJECT__CONTENT:
			return content != null && !content.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(')');
		return result.toString();
	}

} //ObjectImpl
